package com.noahplat.fence.mapper;

import com.noahplat.fence.pojo.Fencere;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Set;

public interface FencereMapper extends Mapper<Fencere> {
    @Select("select fid from tb_fencere where imei = #{imei}")
    public List<Long> getFid(@Param("imei") String imei);  //通过imei获得围栏id集合
    @Insert("<script> INSERT INTO tb_fencere(imei,fid) VALUES <foreach collection = 'imei' item='record' separator=','>" +
            "(#{record},#{fid})</foreach></script>")
    int insertFencere(@Param("imei") Set<String> imei,@Param("fid") Long fid);
    @Select("select imei from tb_fencere where fid = #{fid}")
    List<String> getImei(@Param("fid") Long fid); //通过围栏id获得相关的设备标识
}
